
{literal}

<script>

$(document).ready(function() { 
	    
   $('#file_upload').uploadify({
          'uploader'  : '/public/scripts/uploadify.swf',
          'script'    : '/upload',
          'cancelImg' : '/public/scripts/cancel.png',
          'auto'      : false,
          'method'	  : 'post',
          'multi'	:	false,
          'onComplete'  : function(event, ID, fileObj, response, data) {
          		
          		var obj = jQuery.parseJSON(response);
          		$('#filesId').val(obj.filesId);
          		$("#uploadBox").html('uploaded');
          		//alert($('#filesId').val());
			},
			'onError'     : function (event,ID,fileObj,errorObj) {
			      alert(errorObj.type + ' Error: ' + errorObj.info);
			},
			'scriptData'  : {{/literal}'fileTypesId':'{$fileTypesId}', 'sessionId': '{$sessionId}','destination': '{$uploadDestination}'{literal}}
		
    });
});

</script>

<style>

#discussion-box h1{
	font-size: 22pt;
	font-weight: bold;
}

#discussion-box .message_form {
	margin-top: 10px;
	width: 620px;
}

#discussion-box .left_side{
	width: 40px;
	padding-right: 10px;
}

#discussion-box .left_side img{
	border:1px solid silver;
	padding: 4px;
}

#discussion-box .right_side{
	width: 540px;
	background-color: #E4F1F5;
	padding-left: 10px;
	padding-right: 10px;
	padding-top: 0px;
	padding-bottom: 10px;
	-moz-border-radius: 5px 5px 5px 5px;
	margin: 0px;
}

#discussion-box .right_side_gray{
	width: 540px;
	background-color: #EEEEEE;
	padding-left: 10px;
	padding-right: 10px;
	padding-top: 0px;
	padding-bottom: 10px;
	-moz-border-radius: 5px 5px 5px 5px;
	margin: 0px;
}

#discussion-box .arrow {
    background: url("/public/styles/images/msg-arrows.png") no-repeat scroll 0 -61px transparent !important;
    left: -18px;
    position: relative;
    top: 10px;
    height: 20px;
    width: 10px;
    float: left;
}

#discussion-box .arrow_gray {
    background: url("/public/styles/images/msg-arrows.png") no-repeat scroll 0 -11px transparent !important;
    left: -18px;
    position: relative;
    top: 10px;
    height: 20px;
    width: 10px;
    float: left;
}

#discussion-box .right_side textarea{
	border:1px solid silver;
	width: 535px;
	height: 180px;
	margin-top: 0px;
	padding: 0px;
	position: relative;
	top: -10px;
}

#discussion-box .send{
	width: 80px;
	background-color: #FAFAFA;
	border-bottom: 2px solid #B6B6B6;
	border-right: 2px solid #B6B6B6;
	border-left: 1px solid #B6B6B6;
	border-top: 1px solid #B6B6B6;
	cursor: pointer;
}

#discussion-box .desc{
	margin-top: 10px;
	margin-bottom: 20px;
	width: 350px;
	color: gray;
	font-size: 9pt;
	font-weight: normal;
}

#discussion-box .right_side ._textarea{
	background-color: #FFFFFF;
	padding: 10px;
	border:1px solid silver;
	width: 515px;
	margin-top: 0px;
	position: relative;
	top: -10px;
	font-size: 11pt;
}

#discussion-box .right_side ._date{
	margin-top: 0px;
	margin-bottom: 10px;
	font-size: 10pt;
	font-weight: bold;
	position: relative;
	top: -10px;
}

#discussion-box .right_side ._date a:hover{
	margin-top: 0px;
	margin-bottom: 10px;
	font-size: 10pt;
	font-weight: bold;
}

#uploadComponent{
	width: 150px;
}

#uploadComponent a{
	font-size: 10pt;
}

#uploadComponent a:hover{
	font-size: 10pt;
}

#uploadComponent a:visited{
	font-size: 10pt;
}

#discussion-box ._link a:link{
	font-size: 10pt;
}

#discussion-box ._link a:hover{
	font-size: 10pt;
}

#discussion-box ._link a:visited{
	font-size: 10pt;
}

#attachment {
	display: none;
}

#discussion-box .top-bar{
	font-size: 8pt;
	color: #999999;
	border-bottom: 1px solid #DDDDDD;
	border-top: 1px solid #DDDDDD;
	margin-top: 20px;
	padding: 1px;
}
</style>
{/literal}
{strip}

<div id="content">
    <div id="content_left">
    	<div id="discussion-box">
    	<h1>Conversation with <a href="/users/{$discussion->getRecipient()->getUsername()}" style="text-decoration: none; font-weight: normal;">{$discussion->getRecipient()->getUsername()}</a></h1>
    	<div class="top-bar">
    		<div class="left" style="margin-top: 4px;">Conversation started: {$discussion->getAddDate()}</div>
    		<div class="right">
    			<select>
    				<option value="0">Quick navigation</option>
    			</select>
    		</div>
    		<div class="clear"></div>
    	</div>
    	{foreach $discussion->getComments() as $c}
    		<div class="message_form">
    				<div class="left left_side">
	    				{$c->getUser()->getThumb(30,30,'zc')}
	    			</div>
	    			
	    			<div class="left right_side">
	    			<div class="arrow left"></div>
	    			<div class="left _link">
	    				<div class="_date">{$c->getAddDate()} <a href="/users/{$c->getUser()->getUsername()}">{$c->getUser()->getUsername()}</a></div>
	    				<div class="_textarea" >{$c->getContent()}</div> 
	    			
	    				
	    			</div>
	    			
	    			</div>
	    			
	   			<div class="clear"></div>
    	</div>
    	{/foreach}
    	<div class="message_form">
    		<form method="POST" action="/message/save">
    				<div class="left left_side">
	    				{$loggedUser->getThumb(30,30,'zc')}
	    			</div>
	    			
	    			<div class="left right_side">
	    			<div class="arrow left"></div>
	    			<div class="left _link">
	    				<textarea name="addForm[content]"></textarea> 
	    			
	    				<a href="" onclick="$('#attachment').show();return false;" class="pointer">Add file attachment</a>
	    				
	    				<div class="left" id="attachment">
	    					<div id="uploadComponent" class="left">
								<input id="file_upload" name="file_upload" type="file" />
								<a href="javascript:$('#file_upload').uploadifyUpload();">Upload File</a>
							</div>
							<div class="left desc">For multiple files we recommend using a file-compression utility. Notice: By uploading you agree that the content of the uploaded file doesn't violate XProject's <a href="/terms">terms of service</a> & that you own all copyrights for it and/or an authorization to use it. </div>
							<div class="clear"></div>
						</div>
	    			</div>
	    			
	    				<input type="hidden" name="addForm[discussionsId]" value="{$discussion->getId()}"/>
    					<input id="filesId" type="hidden" name="addForm[filesId]" value=""/>
    					<input id="recipientId" type="hidden" name="addForm[recipientId]" value="{if $loggedUser->getId() == $discussion->getRecipient()->getId()}{$discussion->getUsersId()}{else}{$discussion->getRecipient()->getId()}{/if}"/>
	   					<input type="submit" value="Send" class="right pointer send"/>
	    			</div>
	    			
	   			<div class="clear"></div>
    		</form>
    	</div>
    	</div>
	</div>
	
	<div id="content_right">
		{include file='block_categories.tpl'}
                    <br />
                    {include file='block_requests.tpl'}
                    <br />
	</div>
</div>
<!-- end content  -->


{/strip}